package cn.gson.crm.control.callback;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.control.base.BaseServlet;
import cn.gson.crm.model.dao.CallbackDao;
import cn.gson.crm.model.po.CallbackPo;
@WebServlet("/callback/update")
public class CallbackUpdateServlet extends BaseServlet{
	private CallbackDao callbackDao = new CallbackDao();
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Override
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String callbackId = request.getParameter("cid");
		CallbackPo callbackPo = callbackDao.selectCallback(callbackId);
		request.setAttribute("callbackPo", callbackPo);
		forward("callback/callback_update.jsp");
	}

	@Override
	protected void post(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String callbackId =  request.getParameter("id");
		String callbackCompany =  request.getParameter("callbackCompany");
		String callbackMoney =  request.getParameter("callbackMoney");
		String callbackPosition =  request.getParameter("callbackPosition");
		String callbackContent =  request.getParameter("callbackContent");
		String callbackTime =  request.getParameter("callbackTime");
		callbackDao.updateCallback(callbackId,callbackCompany,callbackMoney,callbackPosition,callbackContent,callbackTime);
		forward("../../callback/manager");
	}
}
